#ifndef Stub_OTClient_h
#define Stub_OTClient_h

#include <OTClient.h>
#include <vector>

/**
 * A stub class to map the native OTClient C++ API to an equivalent 
 * Python-friendly API.
 *
 * Why is this necessary ?
 * :TODO: 
 * 
 * How does it work ?
 * :TODO:
 *
 */
class Stub_OTClient : public OTClient
{
public:
    virtual 
    void 
    onListExchanges( const std::vector<OTExchange*>& exchangeList ) ;
    
    virtual 
    void
    onListSymbols( const std::vector<OTSymbol*>& symbolList ) ;
private:    
    virtual 
    void 
    onListExchanges( OTExchange* exchangeList, 
                     int         exchangeCount ) ;
    
    virtual 
    void 
    onListSymbols( OTSymbol* symbolList, 
                   int       symbolCount ) ;
    
} ;

inline
void
Stub_OTClient::onListExchanges( const std::vector<OTExchange*>& /* unused */ )
{
    /* empty */
}

inline
void
Stub_OTClient::onListSymbols( const std::vector<OTSymbol*>& /* unused */ ) 
{
    /* empty */   
}

inline
void
Stub_OTClient::onListExchanges( OTExchange* const exchangeList,
                                const int         exchangeCount )
{
    std::vector<OTExchange*> exchange_list ;
    for( int i=0; i<exchangeCount; ++i)
    {
        exchange_list.push_back( &exchangeList[i] ) ;   
    }
    this->onListExchanges( exchange_list ) ;
    return ;
}


void 
Stub_OTClient::onListSymbols( OTSymbol* const symbolList, 
                              const int       symbolCount ) 
{
    std::vector<OTSymbol*> symbol_list ;
    for( int i=0; i<symbolCount; ++i)
    {
        symbol_list.push_back( &symbolList[i] ) ;   
    }
    this->onListSymbols( symbol_list ) ;
    return ;    
}

#endif 
